package com.dunhor.scala

class UseTrait {

}

trait Logger{
  def log(msg:String): Unit ={
    println("log:" + msg)
  }
}

class ConcreteLogger extends Logger{
  def concreteLog: Unit ={
    log("It's me !")
  }
}

trait traitLogger{
  def log(msg:String)
}

trait ConsoleLogger extends traitLogger{
  def log(msg: String): Unit ={
    println(msg)
  }
}

class Test extends ConcreteLogger{
  def test(): Unit ={
    log("Here is Spark!")
  }
}


trait Flogger{
  def log(msg:String): Unit ={
    println("Log content is :" + msg)
  }
}

trait MessageFlogger extends Flogger{
  override def log(msg: String): Unit ={
    println("Log Message is " + msg)
  }
}

abstract class Account{
  def save
}

class MyAccount extends Account with Flogger{
  def save: Unit ={
    log("10000")
  }
}

object UseTrait extends App{
  //  val logger = new ConcreteLogger
  //  logger.concreteLog

//  val logger = new Test
//  logger.test()

//  val acc = new MyAccount
//  acc.save

  val acc = new MyAccount with MessageFlogger
  acc.save
}